<?php
namespace App\Service\OrderService\OrderNotifyService;

use Hyperf\Task\Annotation\Task;
use App\Service\Code\Normal;

class XyB2bNotifyService extends BaseNotifyService
{
    protected $user_type    = 'xyb2b';
    protected $message_type = 'OrderExpress';
    
    /**
     * @Task
     * 接收通知物流
     * @param array $param
     */
    public function OrderExpress( $param = [] )
    {
        if( empty($param) ) {
            return $this->getErrorResponseCode();
        }
    
        $response = $this->getResponseCode();
        $this->response_to_req = $response;
        $this->message = $param;
        $result = $this->addNotifyCallBackLog();
        if( $result['code'] != Normal::SUC ) {
            return $this->getErrorResponseCode();
        }
        return $response;
    }
        
    /**
     * 获取接收响应标准
     * 参照当前上游通知业务标准来
     * 错误
     */
    public function getErrorResponseCode()
    {
        return [
            'success'   => false,
            'message'   => '数据不能为空',
        ];
    }
    
    /**
     * 获取接收响应标准
     * 参照当前上游通知业务标准来
     */
    public function getResponseCode()
    {
        return [
            'success'   => true,
            'message'   => '接收成功'
        ];
    }
}